
import wx
from core.ui.mainframe import MainFrame

class ToolTips:
    
    def __init__(self):
        self._tooltip=None
    
    def open(self,localObject,pos):
        if localObject.ext=="png" or localObject.ext=="jpg" or localObject.ext=="gif":
            self._tooltip=PreviewFrame(localObject,pos)
    
    def close(self):
        self._tooltip.Destroy()
    
class PreviewFrame(wx.Frame):
    def __init__(self,localObject,pos):
        wx.Frame.__init__(self,MainFrame(),pos,200,200)
        self.panel=wx.Panel(self)
        
        bmp=wx.Image(localObject.path).ConvertToBitmap()
        wx.StaticBitmap(self.panel, -1, bmp, (200, 200))
